/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.d2g.realestate.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author d2g
 */
@Entity
@Table(name = "announce_type", catalog = "dd111", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AnnounceType.findAll", query = "SELECT a FROM AnnounceType a"),
    @NamedQuery(name = "AnnounceType.findByIdAnnounceStatus", query = "SELECT a FROM AnnounceType a WHERE a.idAnnounceStatus = :idAnnounceStatus"),
    @NamedQuery(name = "AnnounceType.findByType", query = "SELECT a FROM AnnounceType a WHERE a.type = :type")})
public class AnnounceType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
//    @NotNull
    @Column(name = "id_announce_status", nullable = false)
    private Integer idAnnounceStatus;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "type", nullable = false, length = 45)
    private String type;

    public AnnounceType() {
    }

    public AnnounceType(Integer idAnnounceStatus) {
        this.idAnnounceStatus = idAnnounceStatus;
    }

    public AnnounceType(Integer idAnnounceStatus, String type) {
        this.idAnnounceStatus = idAnnounceStatus;
        this.type = type;
    }

    public Integer getIdAnnounceStatus() {
        return idAnnounceStatus;
    }

    public void setIdAnnounceStatus(Integer idAnnounceStatus) {
        this.idAnnounceStatus = idAnnounceStatus;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAnnounceStatus != null ? idAnnounceStatus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AnnounceType)) {
            return false;
        }
        AnnounceType other = (AnnounceType) object;
        if ((this.idAnnounceStatus == null && other.idAnnounceStatus != null) || (this.idAnnounceStatus != null && !this.idAnnounceStatus.equals(other.idAnnounceStatus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.d2g.realestate.persistence.AnnounceType[ idAnnounceStatus=" + idAnnounceStatus + " ]";
    }
    
}
